<template>
  <div>
    <input data-test="input" type="text" v-model="inputVal" @keyup.enter="addItem" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      inputVal: ""
    };
  },
  methods:{
    addItem(){
      if(this.inputVal){
        this.$emit('add',this.inputVal);
        this.inputVal = '';
      }
    }
  }
};
</script>
<style lang="stylus"></style>
